import threading


m = 5
n = 0
def inc(thread_name):
    global  n
    for i in range(m):
        print(thread_name + " is working")
        n += 1
if __name__ == "__main__":
    try:
        t1 = threading.Thread(target= inc, args=("thread-1", )) # 用逗号表明这是一个元组
        t2 = threading.Thread(target=inc, args=("thread-2", ))
        t1.start()
        t2.start()
        t1.join()
        t2.join()
    except:
        print("Error: unable to start thread")
    print(n)